package com.jinkaimen.goodcash.http;


import android.text.TextUtils;

import com.ht.baselibs.retrofit.interceptor.PreParamsInterceptor;
import com.ht.baselibs.utils.DateUtils;
import com.ht.baselibs.utils.DeviceUtils;
import com.ht.baselibs.utils.SharedPreferencesUtils;
import com.jinkaimen.goodcash.constant.HttpConfig;

import java.util.HashMap;
import java.util.Map;


/**
 * Created by huangtao on 16/7/7.
 */
public class ParameterInterceptor extends PreParamsInterceptor {

    @Override
    public Map<String, String> getPostGlobalParams() {
        Map<String, String> map = new HashMap<>();
        map.put(HttpConfig.GlobalParam.APP_TYPE, "android");
        map.put(HttpConfig.GlobalParam.V, "v1.8");
        map.put(HttpConfig.GlobalParam.TIME_STAMP, DateUtils.getCurrentTime());
        map.put(HttpConfig.GlobalParam.DEVICE_ID, DeviceUtils.getDeviceId()+"");
        String token = SharedPreferencesUtils.getString(ConsultInterceptor.ACCESS_TOKEN, "");
        if (!TextUtils.isEmpty(token)){
            map.put(HttpConfig.GlobalParam.ACCESS_TOKEN, token);
        }
        return map;
    }
}